package cc.decat.escript.ir.expression;

import cc.decat.escript.ir.Node;
import cc.decat.escript.ir.Visitor;

public class BinaryExpression extends Expression {

    public enum OpType {
        ADD, SUB, MUL, DIV, MOD,
        LT, LTE, GT, GTE, EQ, NEQ,
        BIT_AND, BIT_OR, BIT_XOR,
        LOGIC_AND, LOGIC_OR,
    }

    private final Node left;
    private final OpType opType;
    private final Node right;

    public BinaryExpression(Node left, OpType opType, Node right) {
        this.left = left;
        this.opType = opType;
        this.right = right;
    }

    @Override
    public void accept(Visitor visitor) {
        visitor.visit(this);
    }

    public Node getLeft() {
        return left;
    }

    public OpType getOpType() {
        return opType;
    }

    public Node getRight() {
        return right;
    }
}
